<?php

class ControllerAdmin_Modmain extends ControllerAdmin_Base
{
	public function __construct($section) {
		$this->section = $section;
		$this->common_vars  = Registry::get("common_vars");
	}
	
	public final function init() {}	
	public function out()
	{
		$r =& Registry::get("MDB")->query("SELECT `Name`,`ID`,`Parent` FROM ".DB_STRUCTURE." WHERE `Parent`='".$this->common_vars["structure_id"]."' ORDER BY `Por`;");
		if (PEAR::isError($r)) {
			die($r->getMessage().' ::: '.$r->getUserInfo());
		}
		if($r->numRows()) {
			while($p = $r->fetchRow(MDB2_FETCHMODE_ASSOC)) {
				$arr[] = $p;
			}
			Registry::get("smarty")->assign(array('ARRAY' => $arr));
			return Registry::get("smarty")->fetch(TEMPLATE_ADMIN.$this->common_vars["controller_template"], Registry::get("cache_id"));			
		}
	}
}

$controller = new ControllerAdmin_Modmain($section);
$ob_admin_out = $controller->out();

?>